#!/bin/bash

# 检查tftp-server是否已安装
if rpm -q tftp-server >/dev/null 2>&1; then
    echo "[-] 检测失败: tftp-server已安装"
    
    # 显示已安装的TFTP相关包
    echo "    已安装的TFTP相关包:"
    rpm -qa | grep tftp | sed 's/^/    /'
    
    # 检查服务状态
    if systemctl is-active tftp.socket >/dev/null 2>&1; then
        echo "    tftp.socket服务正在运行"
    fi
    if systemctl is-active tftp.service >/dev/null 2>&1; then
        echo "    tftp.service服务正在运行"
    fi
    
    exit 1
else
    echo "[+] 检测通过: tftp-server未安装"
    exit 0
fi

